package com.fesine.quartz.util;

import java.io.File;
import java.io.FileFilter;

/**
 * @description: 类描述
 * @author: Fesine
 * @createTime:2016/11/15 20:22
 * @update:修改内容
 * @author: Fesine
 * @updateTime:2016/11/15 20:22
 */
public class FileExtensionFileFilter implements FileFilter {
    private String extension;

    public FileExtensionFileFilter(String extension) {
        this.extension = extension;
    }

    /*
    * Pass the File if it has the extension.
    */
    @Override
    public boolean accept(File file) {
        // Lowercase the filename for easier comparison
        String lCaseFilename = file.getName().toLowerCase();

        return (file.isFile() &&
                (lCaseFilename.indexOf(extension) > 0)) ? true : false;
    }
}
